import Vue from 'vue'
import VueRouter from 'vue-router'
import AdminIndexVue from '../views/AdminIndex.vue'
import AdminIndex2Vue from '../views/AdminIndex2.vue'
import AdminLoginVue from '../views/AdminLogin.vue'
import AddEquipmentsVue from '../views/Equipment/AddEquipments.vue'
import DeleteEquipmentVue from '../views/Equipment/DeleteEquipment.vue'
import EquipmentsVue from '../views/Equipment/Equipments.vue'
import EquipmentsDetalisVue from '../views/Equipment/EquipmentsDetalis.vue'
import FindEquipmentByIdVue from '../views/Equipment/FindEquipmentById.vue'
import FindEquipmentsByExampleVue from '../views/Equipment/FindEquipmentsByExample.vue'
import UnderEquipmentVue from '../views/Equipment/UnderEquipment.vue'
import UpdateEquipmentVue from '../views/Equipment/UpdateEquipment.vue'
import UpEquipmentVue from '../views/Equipment/UpEquipment.vue'
import AddNoticeVue from '../views/Notice/AddNotice.vue'
import AllNoticeVue from '../views/Notice/AllNotice.vue'
import DeleteNoticeVue from '../views/Notice/DeleteNotice.vue'
import UpdateNoticeVue from '../views/Notice/UpdateNotice.vue'
import CancelledOrdersVue from '../views/Orders/CancelledOrders.vue'
import DailyOrdersVue from '../views/Orders/DailyOrders.vue'
import HistoricalOrdersVue from '../views/Orders/HistoricalOrders.vue'
import OrdersInformationChartVue from '../views/Orders/OrdersInformationChart.vue'
import UnprocessedOrdersVue from '../views/Orders/UnprocessedOrders.vue'
import LeaveMessageReplyVue from '../views/Staffs/LeaveMessageReply.vue'
import StaffIndexVue from '../views/Staffs/StaffIndex.vue'
import StaffLoginVue from '../views/Staffs/StaffLogin.vue'
import StaffMainVue from '../views/Staffs/StaffMain.vue'
import AddStaffsVue from '../views/StaffsManage/AddStaffs.vue'
import DeleteStaffsVue from '../views/StaffsManage/DeleteStaffs.vue'
import FindAllStaffsVue from '../views/StaffsManage/FindAllStaffs.vue'
import UpdateStaffsVue from '../views/StaffsManage/UpdateStaffs.vue'
import TestVue from '../views/Test.vue'
import Test2Vue from '../views/Test2.vue'
import CombinationSetVue from '../views/User/CombinationSet.vue'
import HotEquipmentsVue from '../views/User/HotEquipments.vue'
import IndexVue from '../views/User/Index.vue'
import NoticeDetailsVue from '../views/User/NoticeDetails.vue'
import PersonalEquipmentsVue from '../views/User/PersonalEquipments.vue'
import PromotionalEquipmentsVue from '../views/User/PromotionalEquipments.vue'
import SearchEquipmentsVue from '../views/User/SearchEquipments.vue'
import UserCenterVue from '../views/User/UserCenter.vue'
import CartVue from '../views/User/UserCenter/Cart.vue'
import CustomerServiceVue from '../views/User/UserCenter/CustomerService.vue'
import MyOrdersVue from '../views/User/UserCenter/MyOrders.vue'
import PasswordSettingVue from '../views/User/UserCenter/PasswordSetting.vue'
import PaySuccessVue from '../views/User/UserCenter/PaySuccess.vue'
import PersonInfoVue from '../views/User/UserCenter/PersonInfo.vue'
import UserHistoricalOrdersVue from '../views/User/UserCenter/UserHistoricalOrders.vue'
import UserHistoricalOrdersDetailsVue from '../views/User/UserCenter/UserHistoricalOrdersDetails.vue'
import UserNoticeVue from '../views/User/UserNotice.vue'
import UserRegistVue from '../views/User/UserRegist.vue'
import UserIndexVue from '../views/UserIndex.vue'
import UserIndex2Vue from '../views/UserIndex2.vue'
import UserLoginAndRegistVue from '../views/UserLoginAndRegist.vue'
import AllUserVue from '../views/UserManage/AllUser.vue'
import UserInformationChartVue from '../views/UserManage/UserInformationChart.vue'
import AbnormalEquipmentVue from '../views/UsersEquipments/AbnormalEquipment.vue'
import AllUsersEquipmentsVue from '../views/UsersEquipments/AllUsersEquipments.vue'
import UsersEquipmentsInformationChartVue from '../views/UsersEquipments/UsersEquipmentsInformationChart.vue'
import UsersEquipmentsStatusVue from '../views/UsersEquipments/UsersEquipmentsStatus.vue'



Vue.use(VueRouter)

const routes = [{
		path: '/',
		name: '用户首页',
		redirect: '/index',
		component: UserIndex2Vue,
		children: [{
				path: 'index',
				name: '首页',
				//redirect:'/user',
				component: IndexVue,
			},
			{
				path: 'comset',
				name: '组合套餐',
				component: CombinationSetVue
			},
			{
				path: 'serarchequipments',
				name: '搜索商品',
				// redirect:'/serarchequipments',
				component: SearchEquipmentsVue
			},
			{
				path: 'test2',
				name: '测试2',
				component: Test2Vue
			},
			{
				path: 'proequipments',
				name: '促销设备',
				component: PromotionalEquipmentsVue
			},
			{
				path: 'hotequipments',
				name: '热卖设备',
				component: HotEquipmentsVue
			}, {
				path: 'equip',
				name: '设备信息',
				component: EquipmentsVue
			},
			{
				path: 'equipmentDetails',
				name: '设备详情',
				component: EquipmentsDetalisVue
			},
			{
				path: 'findByExample',
				name: '分类查询设备信息',
				component: FindEquipmentsByExampleVue
			}, {
				path: 'pequip',
				name: '个人设备信息',
				component: PersonalEquipmentsVue
			}, {
				path: 'usernotice',
				name: '用户公告信息',
				component: UserNoticeVue
			}, {
				path: 'cart',
				name: '购物车',
				component: CartVue
			}, {
				path: 'myOrder',
				name: '用户订单',
				component: MyOrdersVue
			},
			{
				path: 'userHistoricalOrders',
				name: '历史订单',
				component: UserHistoricalOrdersVue
			},
			{
				path: 'userHistoricalOrdersDetails',
				name: '历史订单详情',
				component: UserHistoricalOrdersDetailsVue
			},
			{
				path: 'paySuccess',
				name: '支付成功',
				component: PaySuccessVue
			},
			{
				path: 'noticeDetails',
				name: '新闻详情',
				component: NoticeDetailsVue
			},
		]
	},
	{
		path: '/usercenter',
		name: '用户中心',
		redirect: '/usercenter/personInfo',
		component: UserCenterVue,
		children: [{
				path: 'personInfo',
				name: '个人信息',
				component: PersonInfoVue
			}, {
				path: 'cart',
				name: '购物车',
				component: CartVue
			},
			{
				path: 'myOrder',
				name: '用户订单',
				component: MyOrdersVue
			}, {
				path: 'userHistoricalOrders',
				name: '历史订单',
				component: UserHistoricalOrdersVue
			},
			{
				path: 'userHistoricalOrdersDetails',
				name: '历史订单详情',
				component: UserHistoricalOrdersDetailsVue
			}, {
				path: 'customerService',
				name: '联系客服',
				component: CustomerServiceVue
			}, {
				path: 'passwordSetting',
				name: '密码设置',
				component: PasswordSettingVue
			},
			{
				path: 'paySuccess',
				name: '支付成功',
				component: PaySuccessVue
			},
		]
	},
	{
		path: '/test',
		name: '测试页面',
		//redirect:'/user',
		component: TestVue
		// redirect:'/test',
		// component: TestVue
	}, {
		path: '/userloginandregist',
		name: '用户登录注册',
		//redirect:'/user',
		component: UserLoginAndRegistVue
		// redirect:'/test',
		// component: TestVue
	},
	{
		path: '/staffIndex',
		name: '员工首页',
		component: StaffIndexVue,
		redirect: '/staffIndex/main',
		children: [{
				path: 'main',
				name: '留言回复',
				component: StaffMainVue
			},
			{
				path: 'leaveMessageReply',
				name: '留言回复',
				component: LeaveMessageReplyVue
			},
		]
	},
	{
		path: '/staffLogin',
		name: '员工登录',
		component: StaffLoginVue
	},
	{
		path: '/userRegist',
		name: '用户注册',
		component: UserRegistVue

	}, {
		path: '/admin',
		name: '管理员登录',
		//redirect:'/user',
		component: AdminLoginVue
		// redirect:'/test',
		// component: TestVue
	},
	{
		path: '/adminIndex',
		name: '首页',
		component: AdminIndexVue,
		redirect: '/adminIndex/equip',
		// path: '/adminIndex2',
		// name: '首页',
		// component: AdminIndex2Vue,
		// redirect: '/adminIndex2/equip',
		//requireAuth: true,
		children: [{
				path: 'equip',
				name: '设备信息',
				component: EquipmentsVue
			},
			{
				path: 'addequip',
				name: '添加设备信息',
				component: AddEquipmentsVue
			},
			{
				path: 'underequip',
				name: '下架设备信息',
				component: UnderEquipmentVue
			},
			{
				path: 'updateEquipment',
				name: '更改设备信息',
				component: UpdateEquipmentVue
			},
			{
				path: 'upEquipment',
				name: '上架设备',
				component: UpEquipmentVue
			},
			{
				path: 'findEquipmentById',
				name: '根据设备编号查看设备信息',
				component: FindEquipmentByIdVue
			},
			{
				path: 'findByExample',
				name: '分类查询设备信息',
				component: FindEquipmentsByExampleVue
			},
			{
				path: 'deleteEquipment',
				name: '删除设备',
				component: DeleteEquipmentVue
			}, {
				path: 'allUser',
				name: '所有用户信息',
				component: AllUserVue
			}, {
				path: 'userInformationChart',
				name: '用户信息可视化大屏',
				component: UserInformationChartVue
			}, {
				path: 'allNotice',
				name: '通知信息',
				component: AllNoticeVue
			}, {
				path: 'addNotice',
				name: '增加公告信息',
				component: AddNoticeVue
			}, {
				path: 'deleteNotice',
				name: '删除公告信息',
				component: DeleteNoticeVue
			}, {
				path: 'updateNotice',
				name: '更新公告信息',
				component: UpdateNoticeVue
			},
			{
				path: 'addStaffs',
				name: '增加员工信息',
				component: AddStaffsVue
			},
			{
				path: 'allStaffs',
				name: '查看所有员工信息',
				component: FindAllStaffsVue
			}, 
			{
				path: 'updateStaffs',
				name: '更新员工信息',
				component: UpdateStaffsVue
			}, 
			{
				path: 'deleteStaffs',
				name: '删除员工信息',
				component: DeleteStaffsVue
			}, 
			{
				path: 'unprocessedOrders',
				name: '未处理订单',
				component: UnprocessedOrdersVue
			}, {
				path: 'cancelledOrders',
				name: '取消的订单',
				component: CancelledOrdersVue
			}, {
				path: 'historicalOrders',
				name: '历史订单',
				component: HistoricalOrdersVue
			}, {
				path: 'dailyOrders',
				name: '当日订单',
				component: DailyOrdersVue
			}, {
				path: 'ordersInformationChart',
				name: '订单信息可视化大屏',
				component: OrdersInformationChartVue
			}, {
				path: 'allUsersEquipments',
				name: '查询所有用户设备',
				component: AllUsersEquipmentsVue
			}, {
				path: 'abnormalEquipment',
				name: '异常设备',
				component: AbnormalEquipmentVue
			}, {
				path: 'usersEquipmentsStatus',
				name: '用户设备工作状态',
				component: UsersEquipmentsStatusVue
			}, {
				path: 'usersEquipmentsInformationChart',
				name: '用户设备信息可视化大屏',
				component: UsersEquipmentsInformationChartVue
			},
		],

	}
]

//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}


const router = new VueRouter({
	mode: 'history',
	base: '/photovoltaic/', //配置nginx访问结构
	routes
})



export default router